{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<iframe style=\"border:0;outline:none;overflow:hidden\" srcdoc=\"&lt;!DOCTYPE html&gt; &lt;html lang=&quot;en&quot;&gt; &lt;head&gt; &lt;meta charset=&quot;utf-8&quot; /&gt; &lt;link href=&quot;https://www.highcharts.com/highslide/highslide.css&quot; rel=&quot;stylesheet&quot; /&gt; &lt;script type=&quot;text/javascript&quot; src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js&quot;&gt;&lt;/script&gt; &lt;script type=&quot;text/javascript&quot; src=&quot;https://code.highcharts.com/highcharts.js&quot;&gt;&lt;/script&gt; &lt;script type=&quot;text/javascript&quot; src=&quot;https://code.highcharts.com/highcharts-more.js&quot;&gt;&lt;/script&gt; &lt;script type=&quot;text/javascript&quot; src=&quot;https://code.highcharts.com/modules/heatmap.js&quot;&gt;&lt;/script&gt; &lt;script type=&quot;text/javascript&quot; src=&quot;https://code.highcharts.com/modules/exporting.js&quot;&gt;&lt;/script&gt; &lt;/head&gt; &lt;body style=&quot;margin:0;padding:0&quot;&gt; &lt;div id=&quot;container&quot; style=&quot;&quot;&gt;Loading....&lt;/div&gt; &lt;script&gt; $(function(){ Highcharts.setOptions({&quot;global&quot;: {}, &quot;lang&quot;: {}}); var option = {&quot;pane&quot;: {}, &quot;legend&quot;: {}, &quot;colors&quot;: {}, &quot;exporting&quot;: {}, &quot;credits&quot;: {&quot;enabled&quot;: false}, &quot;xAxis&quot;: {&quot;title&quot;: {&quot;text&quot;: &quot;Date&quot;}, &quot;dateTimeLabelFormats&quot;: {&quot;year&quot;: &quot;%b&quot;, &quot;month&quot;: &quot;%e. %b&quot;}, &quot;type&quot;: &quot;datetime&quot;}, &quot;plotOptions&quot;: {&quot;spline&quot;: {&quot;marker&quot;: {&quot;enabled&quot;: true}}}, &quot;labels&quot;: {}, &quot;chart&quot;: {&quot;renderTo&quot;: &quot;container&quot;, &quot;type&quot;: &quot;spline&quot;}, &quot;navigation&quot;: {}, &quot;title&quot;: {&quot;text&quot;: &quot;Snow depth at Vikjafjellet, Norway&quot;}, &quot;tooltip&quot;: {&quot;headerFormat&quot;: &quot;&lt;b&gt;{series.name}&lt;/b&gt;&lt;br&gt;&quot;, &quot;pointFormat&quot;: &quot;{point.x:%e. %b}: {point.y:.2f} m&quot;}, &quot;loading&quot;: {}, &quot;yAxis&quot;: {&quot;title&quot;: {&quot;text&quot;: &quot;Snow depth (m)&quot;}, &quot;min&quot;: 0}, &quot;drilldown&quot;: {}, &quot;series&quot;: {}, &quot;subtitle&quot;: {&quot;text&quot;: &quot;Irregular time data in Highcharts JS&quot;}}; var data = [{&quot;name&quot;: &quot;Winter 2012-2013&quot;, &quot;data&quot;: [[Date.UTC(1970,9,21,0,0,0,0.0), 0], [Date.UTC(1970,10,4,0,0,0,0.0), 0.28], [Date.UTC(1970,10,9,0,0,0,0.0), 0.25], [Date.UTC(1970,10,27,0,0,0,0.0), 0.2], [Date.UTC(1970,11,2,0,0,0,0.0), 0.28], [Date.UTC(1970,11,26,0,0,0,0.0), 0.28], [Date.UTC(1970,11,29,0,0,0,0.0), 0.47], [Date.UTC(1971,0,11,0,0,0,0.0), 0.79], [Date.UTC(1971,0,26,0,0,0,0.0), 0.72], [Date.UTC(1971,1,3,0,0,0,0.0), 1.02], [Date.UTC(1971,1,11,0,0,0,0.0), 1.12], [Date.UTC(1971,1,25,0,0,0,0.0), 1.2], [Date.UTC(1971,2,11,0,0,0,0.0), 1.18], [Date.UTC(1971,3,11,0,0,0,0.0), 1.19], [Date.UTC(1971,4,1,0,0,0,0.0), 1.85], [Date.UTC(1971,4,5,0,0,0,0.0), 2.22], [Date.UTC(1971,4,19,0,0,0,0.0), 1.15], [Date.UTC(1971,5,3,0,0,0,0.0), 0]], &quot;type&quot;: &quot;spline&quot;}, {&quot;name&quot;: &quot;Winter 2013-2014&quot;, &quot;data&quot;: [[Date.UTC(1970,9,29,0,0,0,0.0), 0], [Date.UTC(1970,10,9,0,0,0,0.0), 0.4], [Date.UTC(1970,11,1,0,0,0,0.0), 0.25], [Date.UTC(1971,0,1,0,0,0,0.0), 1.66], [Date.UTC(1971,0,10,0,0,0,0.0), 1.8], [Date.UTC(1971,1,19,0,0,0,0.0), 1.76], [Date.UTC(1971,2,25,0,0,0,0.0), 2.62], [Date.UTC(1971,3,19,0,0,0,0.0), 2.41], [Date.UTC(1971,3,30,0,0,0,0.0), 2.05], [Date.UTC(1971,4,14,0,0,0,0.0), 1.7], [Date.UTC(1971,4,24,0,0,0,0.0), 1.1], [Date.UTC(1971,5,10,0,0,0,0.0), 0]], &quot;type&quot;: &quot;spline&quot;}, {&quot;name&quot;: &quot;Winter 2014-2015&quot;, &quot;data&quot;: [[Date.UTC(1970,10,25,0,0,0,0.0), 0], [Date.UTC(1970,11,6,0,0,0,0.0), 0.25], [Date.UTC(1970,11,20,0,0,0,0.0), 1.41], [Date.UTC(1970,11,25,0,0,0,0.0), 1.64], [Date.UTC(1971,0,4,0,0,0,0.0), 1.6], [Date.UTC(1971,0,17,0,0,0,0.0), 2.55], [Date.UTC(1971,0,24,0,0,0,0.0), 2.62], [Date.UTC(1971,1,4,0,0,0,0.0), 2.5], [Date.UTC(1971,1,14,0,0,0,0.0), 2.42], [Date.UTC(1971,2,6,0,0,0,0.0), 2.74], [Date.UTC(1971,2,14,0,0,0,0.0), 2.62], [Date.UTC(1971,2,24,0,0,0,0.0), 2.6], [Date.UTC(1971,3,2,0,0,0,0.0), 2.81], [Date.UTC(1971,3,12,0,0,0,0.0), 2.63], [Date.UTC(1971,3,28,0,0,0,0.0), 2.77], [Date.UTC(1971,4,5,0,0,0,0.0), 2.68], [Date.UTC(1971,4,10,0,0,0,0.0), 2.56], [Date.UTC(1971,4,15,0,0,0,0.0), 2.39], [Date.UTC(1971,4,20,0,0,0,0.0), 2.3], [Date.UTC(1971,5,5,0,0,0,0.0), 2], [Date.UTC(1971,5,10,0,0,0,0.0), 1.85], [Date.UTC(1971,5,15,0,0,0,0.0), 1.49], [Date.UTC(1971,5,23,0,0,0,0.0), 1.08]], &quot;type&quot;: &quot;spline&quot;}]; option.series = data; var chart = new Highcharts.Chart(option); }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt;\" height=520 width=820></iframe>"
      ],
      "text/plain": [
       "<highcharts.highcharts.highcharts.Highchart at 0x10fef3ac8>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# -*- coding: utf-8 -*-\n",
    "\"\"\"\n",
    "Highcharts Demos\n",
    "Time data with irregular intervals: http://www.highcharts.com/demo/spline-irregular-time\n",
    "\"\"\"\n",
    "from datetime import datetime\n",
    "from highcharts import Highchart\n",
    "H = Highchart()\n",
    "\n",
    "winter_12_13_data = [\n",
    "    [datetime(1970, 10, 21), 0],\n",
    "    [datetime(1970, 11, 4), 0.28],\n",
    "    [datetime(1970, 11, 9), 0.25],\n",
    "    [datetime(1970, 11, 27), 0.2],\n",
    "    [datetime(1970, 12, 2), 0.28],\n",
    "    [datetime(1970, 12, 26), 0.28],\n",
    "    [datetime(1970, 12, 29), 0.47],\n",
    "    [datetime(1971, 1, 11), 0.79],\n",
    "    [datetime(1971, 1, 26), 0.72],\n",
    "    [datetime(1971, 2, 3), 1.02],\n",
    "    [datetime(1971, 2, 11), 1.12],\n",
    "    [datetime(1971, 2, 25), 1.2],\n",
    "    [datetime(1971, 3, 11), 1.18],\n",
    "    [datetime(1971, 4, 11), 1.19],\n",
    "    [datetime(1971, 5, 1), 1.85],\n",
    "    [datetime(1971, 5, 5), 2.22],\n",
    "    [datetime(1971, 5, 19), 1.15],\n",
    "    [datetime(1971, 6, 3), 0]\n",
    "]\n",
    "\n",
    "winter_13_14_data = [\n",
    "    [datetime(1970, 10, 29), 0],\n",
    "    [datetime(1970, 11, 9), 0.4],\n",
    "    [datetime(1970, 12, 1), 0.25],\n",
    "    [datetime(1971, 1, 1), 1.66],\n",
    "    [datetime(1971, 1, 10), 1.8],\n",
    "    [datetime(1971, 2, 19), 1.76],\n",
    "    [datetime(1971, 3, 25), 2.62],\n",
    "    [datetime(1971, 4, 19), 2.41],\n",
    "    [datetime(1971, 4, 30), 2.05],\n",
    "    [datetime(1971, 5, 14), 1.7],\n",
    "    [datetime(1971, 5, 24), 1.1],\n",
    "    [datetime(1971, 6, 10), 0]\n",
    "]\n",
    "\n",
    "winter_14_15_data = [\n",
    "    [datetime(1970, 11, 25), 0],\n",
    "    [datetime(1970, 12, 6), 0.25],\n",
    "    [datetime(1970, 12, 20), 1.41],\n",
    "    [datetime(1970, 12, 25), 1.64],\n",
    "    [datetime(1971, 1, 4), 1.6],\n",
    "    [datetime(1971, 1, 17), 2.55],\n",
    "    [datetime(1971, 1, 24), 2.62],\n",
    "    [datetime(1971, 2, 4), 2.5],\n",
    "    [datetime(1971, 2, 14), 2.42],\n",
    "    [datetime(1971, 3, 6), 2.74],\n",
    "    [datetime(1971, 3, 14), 2.62],\n",
    "    [datetime(1971, 3, 24), 2.6],\n",
    "    [datetime(1971, 4, 2), 2.81],\n",
    "    [datetime(1971, 4, 12), 2.63],\n",
    "    [datetime(1971, 4, 28), 2.77],\n",
    "    [datetime(1971, 5, 5), 2.68],\n",
    "    [datetime(1971, 5, 10), 2.56],\n",
    "    [datetime(1971, 5, 15), 2.39],\n",
    "    [datetime(1971, 5, 20), 2.3],\n",
    "    [datetime(1971, 6, 5), 2],\n",
    "    [datetime(1971, 6, 10), 1.85],\n",
    "    [datetime(1971, 6, 15), 1.49],\n",
    "    [datetime(1971, 6, 23), 1.08]\n",
    "]\n",
    "\n",
    "H.add_data_set(winter_12_13_data, series_type=\"spline\", name=\"Winter 2012-2013\")\n",
    "H.add_data_set(winter_13_14_data, series_type=\"spline\", name=\"Winter 2013-2014\")\n",
    "H.add_data_set(winter_14_15_data, series_type=\"spline\", name=\"Winter 2014-2015\")\n",
    "\n",
    "H.set_options('chart', {\n",
    "    'type': 'spline'\n",
    "})\n",
    "\n",
    "H.set_options('xAxis', {\n",
    "    'type': 'datetime',\n",
    "    'dateTimeLabelFormats': { # don't display the dummy year\n",
    "        'month': '%e. %b',\n",
    "        'year': '%b'\n",
    "    },\n",
    "    'title': {\n",
    "        'text': 'Date'\n",
    "    }\n",
    "})\n",
    "\n",
    "H.set_options('yAxis', {\n",
    "    'title': {\n",
    "        'text': 'Snow depth (m)'\n",
    "    },\n",
    "    'min': 0\n",
    "})\n",
    "\n",
    "H.set_options('title', {\n",
    "    'text': \"Snow depth at Vikjafjellet, Norway\"\n",
    "})\n",
    "\n",
    "H.set_options('subtitle', {\n",
    "    'text': \"Irregular time data in Highcharts JS\"\n",
    "})\n",
    "\n",
    "H.set_options('tooltip', {\n",
    "    'headerFormat': '<b>{series.name}</b><br>',\n",
    "    'pointFormat': '{point.x:%e. %b}: {point.y:.2f} m'\n",
    "})\n",
    "\n",
    "H.set_options('plotOptions', {\n",
    "    'spline': {\n",
    "        'marker': {\n",
    "            'enabled': True\n",
    "        }\n",
    "    }\n",
    "})\n",
    "\n",
    "H"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
